#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define y1 y_alpha_1

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int > vec;
typedef pair < int , int > pii;

int read() {
	int x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-',ch = getchar();
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48),ch = getchar();
	return f ? -x : x;
}

const int N = 2510;
const int mod = 998244353;

int fa[N],dep[N],f[N][N][2][3],cr,cb,stk[N],top,n;
vec G[N];

void upd(int &x) { x = x + (x >> 31 & mod); }

void dfs(int x) {
	int L = max(0,dep[x] - cb),R = min(dep[x],cr); 
	for(int i = L;i <= R;i++) f[x][i][0][0] = 1;
	for(auto y : G[x]) {
		dfs(y); 
		for(int i = L;i <= R;i++) {
			static int g[2][3]; memset(g,0,sizeof g);
			for(int j = 0;j < 2;j++)
				for(int k = 0;k < 3;k++)
					for(int d = 0;d + j < 2;d++)
						for(int l = 0;l + k < 3;l++)
							upd(g[j + d][k + l] += ((k && l) + 1ll) * f[x][i][j][k] * f[y][i][d][l] % mod - mod);
			memcpy(f[x][i],g,sizeof g);
		}
	} if(x == 1) return;
	for(int i = L;i <= R;i++) {
		if(i)
			for(int j = 0;j < 2;j++)
				for(int k = 0;k < 3;k++)
					upd(f[x][i - 1][j][k] += f[x][i][j][k] - mod),
						upd(f[x][i - 1][1][k] += f[x][i][j][k] * (j == 0) - mod);
		if(dep[x] == i) memset(f[x][i],0,sizeof f[x][i]);
		else
			for(int j = 0;j < 2;j++)
				for(int k = 1;k >= 0;k--)
					for(int d = k + 1;d < 3;d++)
						upd(f[x][i][j][d] += f[x][i][j][k] * (1ll + (k == 1)) % mod - mod);
	}
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("stack.in","r",stdin); freopen("stack.out","w",stdout);
#endif
	n = in,cr = in,cb = in; int cnt = 1; stk[0] = 1;
	for(int i = 1;i <= n << 1;i++) {
		static char s[5]; scanf("%s",s + 1);
		if(s[2] == 'u') G[stk[top]].pb(++cnt), fa[cnt] = stk[top],dep[cnt] = dep[stk[top]] + 1,stk[++top] = cnt;
		else top--;
	} dfs(1); printf("%d\n",f[1][0][1][2]); return 0;
}
